﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Smile.Useful
{
    public static class RegexUtilities
    {
        public static bool IsEmail(string input)
        {
            const String pattern =
                @"^([0-9a-zA-Z]" +
                @"([\+\-_\.][0-9a-zA-Z]+)*" +
                @")+" +
                @"@(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z0-9]{2,17})$";
            
            Regex re = new Regex(pattern);

            return re.IsMatch(input);
        }
    }
}
